/*
  将下面异步代码使用 Promise 的方法改进
  尽量用看上去像同步代码的方式
  setTimeout(function () {
    var a = 'hello'
    setTimeout(function () {
      var b = 'lagou'
      setTimeout(function () {
        var c = 'I ♥ U'
        console.log(a + b +c)
      }, 10)
    }, 10)
  }, 10)
*/

// function pro1(a1) {
//   return new Promise((resolve) => {
//     setTimeout(function () {
//       resolve(a1)
//     }, 10)
//   })
// }

// async function pro2() {
//   var p1 = await pro1("hello")
//   var p2 = await pro1("lagou")
//   var p3 = await pro1("I ♥ U")
//   console.log(p1 + p2 + p3)
// }

// pro2();

let result = function(){
  return new Promise((resolve,reject)=>{
  setTimeout(function () {
    var a = 'hello'
    setTimeout(function () {
      var b = 'lagou'
      setTimeout(function () {
        var c = 'I ♥ U'
        resolve(a + b +c);
      }, 10)
    }, 10)
  }, 10)
});
}
async function res (){
  let a = await result();
  console.log(a);
}
res();
// result.then(value=>console.log(value));